﻿<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/common/taglibs.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>账号设置</title>

    <!--common-->
    <link href="/resources/src/css/main.css" rel="stylesheet">
    <link href="/resources/src/css/responsive.css" rel="stylesheet">
    <link href="/resources/src/css/lib/cropper.min.css" rel="stylesheet">
    <link href="/resources/src/css/setting.css" rel="stylesheet">
</head>
<body class="sticky-header left-side-collapsed" style="background-color: #f5f8f9;">
    <jsp:include page="../common/left-slide.jsp" flush="true">
        <jsp:param name="pageHeader" value="settingHeader" />
    </jsp:include>
    <div class="main-content">
        <jsp:include page="../common/header-start.jsp" />
        <div class="setting_wrap">
            <div class="title"><span>账号设置</span></div>
            <div class="setting_list">
                <div class="item clearfix agency_head">
                    <div class="s_label">${(user.type==1)?'机构头像': '个人头像'}：</div>
                    <div class="s_content" style="width: 160px;height: 160px;"><img src="${user.logo }" alt="${(user.type==1)?'机构头像': '个人头像'}：" id="logoButton" onerror="this.src='/resources/src/images/project-logo.png'"></div>
                    <!--<div class="change_head"><input id="saveLogo" disabled='true' value="上传"></div>-->
                </div>
                <div class="item clearfix edit_line">
                    <div class="s_label">${(user.type==1)?'机构名': '用户名'}：</div>
                    <div class="edit_line_txt">${user.userName }</div>
                    <div class="click_icon">
                        <i class="iconfont icon-iconmodify" icontip="修改" data-toggle="modal" data-target="#orgName_btn"></i>
                    </div>
                </div>
                <!--<c:if test="${user.type != 1}">
                	<div class="item clearfix edit_line">
	                    <div class="s_label">所在机构：</div>
	                    <div class="edit_line_txt">微投网</div>
	                    <div class="click_icon">
	                        <i class="iconfont icon-web-quit" icontip="退出机构" data-toggle="modal" data-target="#pullOut-modal"></i>
	                    </div>
	                </div>
                </c:if>-->
                <div class="item clearfix edit_line">
                    <div class="s_label">修改密码：</div>
                    <div class="edit_line_txt">********</div>
                    <div class="click_icon">
                        <i class="iconfont icon-iconmodify" icontip="修改" data-toggle="modal" data-target="#orgPassword_btn"></i>
                    </div>
                </div>
                <div class="item clearfix edit_line">
                    <div class="s_label">绑定邮箱：</div>
                    <div class="edit_line_txt">${user.email }</div>
                    <div class="click_icon">
                        <i class="iconfont icon-iconmodify" icontip="修改" data-toggle="modal" data-target="#orgEmail_btn"></i>
                    </div>
                </div>
                <div class="item clearfix edit_line">
                    <div class="s_label">绑定手机：</div>
                    <div class="edit_line_txt">${user.phone }</div>
                    <div class="click_icon">
                        <i class="iconfont icon-iconmodify" icontip="修改" data-toggle="modal" data-target="#orgPhone_btn"></i>
                    </div>
                </div>
                <!--<div class="item clearfix project_code">
                    <div class="s_label">个人二维码：</div>
                    <div class="s_content">
                        <div  id="showCode"></div>
                        <span class="downLoadCode">（点击下载二维码）</span>
                    </div>
                </div>-->
                <!-- <div class="item clearfix edit_line">
                    <div class="s_label">绑定微信：</div>
                    <div class="edit_line_txt">${(user.openId==null||user.openId=='')?'未绑定': '已绑定'}</div>
                    <div class="click_icon">
                        <span class="unbindWeChat" data-toggle="modal" data-target="#unbindWechat_btn">解绑</span>
                        <i class="iconfont icon-erweima" icontip="绑定微信" data-toggle="modal" data-target="#orgWechat_btn"></i>
                    </div>
                </div> -->
            </div>
        </div>
    </div>  

    
    <!-- 更改机构名模态框（Modal） -->
    <div class="modal fade" id="orgName_btn" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="model_title">
                    <h4>修改名字</h4>
                    <i class="iconfont icon-shanchu" data-dismiss="modal" aria-hidden="true"></i>
                </div>
                <div class="model_content input_type">    
                    <div class="model_input_line">
                        <label for="orgName">机构名称：</label>                 
                        <input type="text" id="orgName" name="orgName" placeholder="请输入新的机构名称" />
                    </div>
                    <div id="saveOrgName" class="save_btn">保存</div>
                    <div class="error_txt"></div>
                </div>
            </div>
        </div>
    </div>
    <!-- /.modal -->
    <!-- 修改密码模态框（Modal） -->
    <div class="modal fade" id="orgPassword_btn" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="model_title">
                    <h4>修改密码</h4>
                    <i class="iconfont icon-shanchu" data-dismiss="modal" aria-hidden="true"></i>
                </div>
                <div class="model_content input_type">    
                    <div class="model_input_line">
                        <label for="oldPassword">旧密码：</label>                 
                        <input type="text" id="oldPassword" name="oldPassword" placeholder="请输入旧密码" />
                    </div>
                    <div class="model_input_line">
                        <label for="newPassword">新密码：</label>                 
                        <input type="text" id="newPassword" name="newPassword" placeholder="请输入新密码" />
                    </div>
                    <div class="model_input_line">
                        <label for="confirmPassword">确认密码：</label>                 
                        <input type="text" id="confirmPassword" name="confirmPassword" placeholder="请再次输入新密码" />
                    </div>
                    <div id="saveOrgPassword" class="save_btn">保存</div>
                    <div class="error_pass_txt"></div>
                </div>
            </div>
        </div>
    </div>
    <!-- /.modal -->
    <!-- 绑定邮箱模态框（Modal） -->
    <div class="modal fade" id="orgEmail_btn" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="model_title">
                    <h4>修改邮箱</h4>
                    <i class="iconfont icon-shanchu" data-dismiss="modal" aria-hidden="true"></i>
                </div>
                <div class="model_content input_type">    
                    <div class="model_input_line">
                        <label for="newEmail">新邮箱：</label>                 
                        <input type="text" id="newEmail" name="newEmail" placeholder="请输入新邮箱" />
                    </div>
                    <div class="model_input_line">
                        <label for="emailCode">验证码：</label>                 
                        <input type="text" id="emailCode" name="emailCode" placeholder="请输入验证码" class="hasCode" />
                        <button class="sendEmailCode sendCode">发送验证码</button>
                    </div>
                    <div id="saveOrgEmail" class="save_btn">保存</div>
                </div>
            </div>
        </div>
    </div>
    <!-- /.modal -->
    <!-- 绑定邮箱模态框（Modal） -->
    <div class="modal fade" id="orgPhone_btn" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="model_title">
                    <h4>修改手机</h4>
                    <i class="iconfont icon-shanchu" data-dismiss="modal" aria-hidden="true"></i>
                </div>
                <div class="model_content input_type">    
                    <div class="model_input_line">
                        <label for="newPhone">手机号：</label>                 
                        <input type="text" id="newPhone" name="newPhone" placeholder="请输入新手机号" />
                    </div>
                    <div class="model_input_line">
                        <label for="phoneCode">验证码：</label>                 
                        <input type="text" id="phoneCode" name="phoneCode" placeholder="请输入验证码" class="hasCode" />
                        <button class="sendCode" id="getCaptcha">发送验证码</button>
                    </div>
                    <div id="saveOrgPhone" class="save_btn">保存</div>
                </div>
            </div>
        </div>
    </div>
    <!-- /.modal -->
    <!-- 绑定微信模态框（Modal） -->
    <div class="modal fade" id="orgWechat_btn" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="model_title">
                    <h4>绑定微信</h4>
                    <i class="iconfont icon-shanchu" data-dismiss="modal" aria-hidden="true"></i>
                </div>
                <div class="model_content wechat_type">    
                    <img src="//img3.tbcdn.cn/tfscom/TB13UCJKVXXXXaLXpXXSutbFXXX.jpg_100x100.jpg" alt="">
                    <div class="bindWeChatTxt">微信扫码绑定账号后，即可在微信管理项目</div>
                </div>
            </div>
        </div>
    </div>
    <!-- /.modal -->
    <!-- 解绑微信模态框（Modal） -->
    <div class="modal fade" id="unbindWechat_btn" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">                
                <div class="model_content wechat_type" style="padding-bottom: 30px;padding-top: 70px;">    
                    <div class="unbindWeChatTxt">解绑微信后，微信将不再接收项目信息，是否确定解绑微信？</div>
                    <div class="unbind_btn_group clearfix">
                        <div class="cancel_unbindWechat" data-dismiss="modal" aria-hidden="true">取消</div>
                        <div class="confirm_unbindWechat">确定</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /.modal -->
    
    <!--退出机构模态框-->
	<div class="modal fade" id="pullOut-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="model_title">
                <h4>退出机构</h4>
                <i class="iconfont icon-shanchu" data-dismiss="modal" aria-hidden="true"></i>
            </div>
			<div class="modal-content text-center" style="border:0; border-radius:0; padding:40px; box-sizing:border-box;">
				<div class="modal-body" style="padding:0 0 40px 0; font-size:16px; color:#333;">
					<div class="text-tip" style="text-align:justify;">一旦你退出该机构，你将不能查看该机构的进度信息。退出机构后，如果想重新加入，请联系机构管理员。</div>
				</div>
				<div class="modal-footer text-center" style="border-top:0; padding:0;">
					<button type="button" class="btn confirm btn-block" style="width:200px; height:50px; line-height:50px; padding:0; background-color:#22A7F4;color:#fff; margin-left:auto; margin-right:auto;">退出</button>
				</div>
			</div>
		</div>
	</div>
    
    <!--头像裁剪模态框-->
    <div id="cutpic-modal">
    	<div class="cutpic-content">
    		<div class="cutpic-body clearfix">
    			<div class="current-pic pull-left">
        			<img src="/resources/src/images/project-logo.png"/>
        		</div>
        		<div class="preview-container pull-left text-center">
        			<div class="preview"></div>
        			<p>效果预览</p>
        		</div>
    		</div>
    		<div class="cutpic-footer">
    			<p class="current-pic-btn"><button class="cancel-upload-logo">取消</button><button class="save-cut-logo">保存</button></p>
    		</div>
    	</div>
    </div>
    
    <script src="/resources/src/js/jquery-1.9.1.min.js"></script>
    <script src="/resources/src/js/jquery.nicescroll.js"></script>
    <script src="/resources/src/js/jquery.qrcode.min.js"></script>
    <script src="/resources/src/js/bootstrap.min.js"></script>
    <script src="/resources/src/js/main.js"></script>
    <jsp:include page="/common/plupload/pluploadInclude.jsp"></jsp:include>
    <script src="/resources/src/js/setting.js"></script>
    <script type="text/javascript">
    $(function(){
    	uploadLogo();
    	
    	var userId = "${user.id}";
    	$.ajax({
			url : "/scanCode/getWechatOpenId",
			type : "post",
			dataType: "json",
			data : {
				"userId":userId,
			},
			success: function(data) {
				if (data.status == true) {
					$("#showCode").qrcode({ 
					    render: "canvas", //table方式 
					    width: 300, //宽度 
					    height:300, //高度 
					    text: data.data //任意内容 
					}); 
				} else {
					alert("获取二维码失败");
					window.location.reload();
				}
			}
		});
		
		//退出机构
		$("#pullOut-modal .confirm").on("click",function(){
			
			//关闭模态框
			$("#pullOut-modal").modal("hide");
		});
    })
    </script>
    
    <script src="/resources/src/js/cropper.min.js"></script> 
	
</body>
</html>